<template>
  <div>
    <table-ext :columns="columns" :searchForm="searchForm" :config="config" ref="tableExt">
    </table-ext>
  </div>
</template>
<script>
  import TableExt from '@/components/common/table-ext/table-ext.vue';
  import TableIcon from '@/components/common/table-ext/table-icon';
   export default {
    // 引入自定义表格组件
    components:{
      'table-ext': TableExt
    },
    data() {
      return {
        config:{ // 页面共通配置
          title: '采购组织关系', //页面标题
          isPage: true, //是否分页
          isNo: true, //是否显示序号
          crudMapping:{ // CRUD方法
            query:{
              url: this.lib.config.host.vendorMgt + '/vendormgt/vsp/common/purorgvendor/getByVendorId',
              data:{'vendorId': this.$route.query.id},
              resultFun(response) { // 修改返回默认值
                return {
                  list: response.data, //返回列表数据
                  total: response.data.total //返回总数
                };
              }
            }
          }
        },
        // 查询表单配置
        searchForm:[{
          label: '采购组织：',
          key: 'purOrgId',
          type: 'select',
          dict: {
            url: this.lib.config.host.masterData + '/system/purOrgMgt/purOrg/getAll',
            method: 'get',
            label: 'purOrgName',
            value: 'id'
          }
        }],
        // 表格列定义
        columns:[{
          label: '新业务终止',
          key: 'stopBusFlag',
          align:'center',
          width:'160px',
          render:(createElement, params)=>{ //动态渲染, 字典表示例
            return createElement(TableIcon,{props:{
                flag: params.row.stopBusFlag,
                titles: [{status:0,title:'否'},{status:1,title:'是'}]
            }});
          }
        },{
          label: '是否冻结',
          key: 'freezeFlag',
          align:'center',
          width:'160px',
          render:(createElement, params)=>{ //动态渲染, 字典表示例
            return createElement(TableIcon,{props:{
                flag: params.row.freezeFlag,
                titles: [{status:0,title:'否'},{status:1,title:'是'}]
            }});
          }
        },{
          label: '采购组织编码  ',
          key: 'purOrg.purOrgCode',
          align:'center',
          width:'250px'
        },{
          label: '采购组织名称',
          key: 'purOrg.purOrgName',
          align:'center',
          width:'250px'
        },{
          label: '销售员',
          key: 'linkman',
          align:'center',
          width:'300px'
        },{
          label: '销售员手机',
          key: 'mobilePhone',
          align:'center',
          width:'160px'
        },{
          label: '销售员邮箱',
          key: 'email',
          align:'center',
          width:'250px'
        },{
          label: '付款条件',
          key: 'paymentTermsName',
          align:'center',
          width:'250px'
        },{
          label: '国际贸易条件1',
          key: 'inco1',
          align:'center',
          width:'250px'
        },{
          label: '国际贸易条件2',
          key: 'inco2',
          align:'center',
          width:'250px'
        },{
          label: '订单货币',
          key: 'poCurrency',
          align:'center',
          width:'250px'
        }]
      }
    }
  }
</script>